package cn.study.luckyapp.prize.command;

import cn.study.luckyapp.assembler.PrizeAssembler;
import cn.study.luckyclient.dto.PrizeAddCmd;
import cn.study.luckyclient.dto.data.PrizeVo;
import cn.study.luckydomain.gateway.PrizeGateway;
import cn.study.luckydomain.prize.PrizeEntity;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;

@AllArgsConstructor
@Slf4j
@Component
public class PrizeAddCmdExe {

    private final PrizeGateway prizeGateway;
    public PrizeVo execute(PrizeAddCmd cmd)
    {
        PrizeEntity add = prizeGateway.add(PrizeAssembler.toEntity(cmd));
        return PrizeAssembler.addPrizeVo(add);
    }
}
